﻿using System;
using System.Collections.Generic;

using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Net.NetworkInformation;
using System.Data;
using System.Collections;

namespace nextwaver.SelfLearning
{
    static class cGobal
    {
        public static string _LogRound = "";
        public static string TicketLogingIn = "";
        public static bool EndOfReserv = false;
        public static int BranchID = 1;
        public static int CurrentUseTime = 0;
        public static string ThemeID = "Theme06_Blue";
        public static string ImagePath = Application.StartupPath + @"\Image1\";
        public static string streamServer = "mms://nextwave-7403f4/BKC/";

        //public static string _ServerUserName = "Administrator";
        //public static string _ServerPassword = "next1nc";
        //public static string _ServerAddress = "192.168.1.254";
        //public static string _ServerShareLink = @"\\DC1\JigsawStorage2\";

        
        private static ConnectServer.cConection Conn = new ConnectServer.cConection();

        //public static string _ServerUserName = "jigsaw";
        //public static string _ServerPassword = "N3xtwaver";
        //public static string _ServerAddress = "192.168.1.3";

        #region Server3
        //\\192.168.1.211\jigsaw
        //public static string _ServerShareLink = @"\\192.168.1.3\jigsaw";
        //public static string _ServerStorage = @"\\192.168.1.3\jigsaw\";
        #endregion

        public static string GetIP()
        {
            IPHostEntry host;
            string localIP = "?";
            host = Dns.GetHostEntry(Dns.GetHostName());
            foreach (IPAddress ip in host.AddressList)
            {
                if (ip.AddressFamily.ToString() == "InterNetwork")
                {
                    localIP = ip.ToString();
                }
            }
            return localIP;

        }

        public static string MacAddress()
        {

            NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
            string MacAddress = "";
            for (int x = 0; x < nics.Length; x++)
            {
                if (nics[x].NetworkInterfaceType == NetworkInterfaceType.Ethernet || nics[x].NetworkInterfaceType == NetworkInterfaceType.Ethernet3Megabit)
                {

                    MacAddress = "" + nics[x].GetPhysicalAddress();
                }
            }

            return MacAddress;

        }

        public static string GetCourseID(string VDOName)
        {
            try
            {
                string CourseIDSQL = "SELECT [CourseID] FROM [dbo].[Dim_Lecture] WHERE LectureID = (SELECT TOP 1 LectureID FROM [dbo].[Dim_Video] WHERE VdoName = '@VDONAME')";
                CourseIDSQL = CourseIDSQL.Replace("@VDONAME", VDOName);
                DataSet dsCourseID = Conn.Retreive(CourseIDSQL, Conn.Conn);
                return dsCourseID.Tables[0].Rows[0][0].ToString();
            }
            catch { return null; }
        }

        public static string TicketBalance = "";

        public static string TicketTime = "";

        public static ArrayList GetRightDetials()
        {
            ArrayList details = new ArrayList();

            return details;
        }

    }


}
